<!DOCTYPE html>
<html>

<head>
    <title>task13</title>
    <meta charset="UTF-8">
    <style type="text/css">
    * {
        font-family: "微软雅黑";
    }
    </style>
</head>

<body>
    <label>
        请输入今天天气情况
        <input id="weather_input" type="text"></input>
    </label>
    <button id="button">确认填写</button>
    <div>您输入的是：<span id="weather_display">尚未录入</span></div>
    <script type="text/javascript">
    (function() {
        var button = document.getElementById("button");
        var weather_input = document.getElementById("weather_input");
        var weather_display = document.getElementById("weather_display");
        button.onclick = function() {
            if (weather_input.value) {
                weather_display.innerHTML = weather_input.value;
            } else {
                alert("请输入");
            }
        }
    })()
    </script>
</body>

</html>
